Skip to content

[FLINK-39958] Honor per-deployment Flink REST client timeout on rescale - #33

Closed
pobed2 wants to merge 1 commit into
Shopify:mainfrom
pobed2:pobed2/flink-39958-honor-per-deployment-rest-timeout
Closed

[FLINK-39958] Honor per-deployment Flink REST client timeout on rescale#33
pobed2 wants to merge 1 commit into
Shopify:mainfrom
pobed2:pobed2/flink-39958-honor-per-deployment-rest-timeout

Conversation

@pobed2

@pobed2 pobed2 commented Jul 29, 2026

Copy link
Copy Markdown

Issue: https://issues.apache.org/jira/browse/FLINK-39958
Requested by: Pierre-Olivier Bédard pierre.bedard@shopify.com
Slack thread: https://shopify.slack.com/archives/C0AKLLE8GPJ/p1785358236166909

What

Why

kubernetes.operator.flink.client.timeout (default 10s) is the budget for the PUT /jobs/<id>/resource-requirements call the operator makes against a running JobManager. It is operator-global — read from FlinkOperatorConfiguration, built by FlinkConfigManager.getDefaultConfig from the operator's own configuration — so a pipeline owner cannot raise it from their FlinkDeployment spec, and the per-deployment-looking job.autoscaler.flink.rest-client.timeout is silently clobbered.

When that call times out, the operator abandons in-place scaling with no retry and falls back to a full savepoint-and-redeploy: suspend with savepoint, delete the JobManager deployment, delete HA metadata, redeploy. On webhooks-production-java-change-event-producer that turns a ~3s rescale into ~150s of no checkpoint progress plus a slow-recovery tail. It fired 7 times in 24h on that pipeline, 17 times fleet-wide across three pipelines.

Raising the tolerance is the lever rather than more JobManager capacity: JM process CPU sat at 7-18% of its one core throughout, and the call blocks behind the adaptive scheduler's main thread while it rebuilds the execution graph and registers newly requested TaskManagers.

Details

  • Change 1 is merged upstream. Change 2 is a new local change and should also be proposed to Apache so the fork can drop it later.
  • Change 2 covers getVertexResources as well as updateVertexResources. Both are REST calls inside the same scale() try block, both were pinned to the operator-global timeout, and both surface as the same Error while rescaling, falling back to regular upgrade. getVertexResources runs first, so leaving it at 10s would keep the teardown path open. Happy to narrow this to updateVertexResources only if you prefer the smaller surface.
  • mvn verify -pl flink-kubernetes-operator: 2113 tests pass, 0 Checkstyle violations, spotless clean.

Autoscaler in-place rescales intermittently fail with a bare
TimeoutException out of NativeFlinkService.updateVertexResources. When
that happens the operator abandons in-place scaling with no retry and
falls back to a full savepoint-and-redeploy: suspend with savepoint,
delete the JobManager deployment, delete HA metadata, redeploy. On the
webhooks-production-java-change-event-producer FlinkDeployment that costs
~150s of no checkpoint progress plus a slow-recovery tail, and it fired 7
times in 24h on that pipeline alone (17 times fleet-wide across three
pipelines) in place of what is normally a ~3s rescale.

The budget for that REST call is kubernetes.operator.flink.client.timeout
(default 10s), which is operator-global: it is read from
FlinkOperatorConfiguration, built by FlinkConfigManager.getDefaultConfig
from the operator's own configuration, so a pipeline owner cannot raise it
from their FlinkDeployment spec. The per-deployment-looking
job.autoscaler.flink.rest-client.timeout is silently clobbered, which is
FLINK-39958.

Two changes:

- Cherry-pick FLINK-39958 (apache#1141) so
  FlinkResourceContext only seeds AutoScalerOptions.FLINK_CLIENT_TIMEOUT
  from the operator timeout when the deployment has not set it.
- Apply the same honor-the-per-deployment-value rule to the in-place
  rescale REST calls in NativeFlinkService. Those read operatorConfig
  directly and so are untouched by FLINK-39958, which is why the
  cherry-pick alone would not stop the teardowns.

No defaults change. With job.autoscaler.flink.rest-client.timeout unset,
both paths resolve to the operator-global timeout exactly as before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Pierre-Olivier Bédard <pierre.bedard@shopify.com>
@pobed2 pobed2 closed this Jul 29, 2026
@pobed2
pobed2 deleted the pobed2/flink-39958-honor-per-deployment-rest-timeout branch July 29, 2026 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant